{% extends 'TopxiaWebBundle::layout.html.twig' %}
{% block title %} {{'订单确认'|trans}} - {{ parent() }}{% endblock %}
{% set script_controller = 'order/create' %}

{% block esBar %}{% endblock %}

{% block content %}
<div class="order-pay">
  <div class="es-section">
    <ul class="es-step es-step-3 clearfix">
      <li class="doing"><span class="number">1</span>{{'订单确认'|trans}}</li>
      <li><span class="number">2</span>{{'订单支付'|trans}}</li>
      <li><span class="number">3</span>{{'订单完成'|trans}}</li>
    </ul>
    <div class="order-pay-body">
      <form id="order-create-form" method="post" action="{{path('order_create')}}">
        <input type="password" style="display:none">
      	{% if order|default(null) %}
        <input type="hidden" name="orderId" value="{{order.id}}"/>
        {% endif %}
      	<input type="hidden" role="cash-rate" value="{{cashRate|default(null)}}"
        data-price-type = "{{priceType|default('RMB')}}" data-cash-model='{{setting('coin.cash_model')|default('none')}}'/>
        <input type="hidden" name="targetType" value="{{targetType}}"/>
        <input type="hidden" name="maxRate" value="{{maxRate|default(100)}}"/>
        <input type="hidden" name="targetId" value="{{targetId}}"/>
        <input type="hidden" name="totalPrice" value="{{totalPrice}}"/>
        <input type="hidden" name="shouldPayMoney" value=""/>
        <input type="hidden" name="sms_code" value=""/>
        <input type="hidden" name="mobile" data-role="mobile" value="{{ verifiedMobile }}"/>
        <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
        <div class="order-detail-bg" style="border:none">
        {% if targetType == "course" and course|default(null) %}
          {% include 'TopxiaWebBundle:Order:order-course.html.twig' %}
        {% endif %}
        {% if targetType == "vip" %}
          {% include 'TopxiaWebBundle:Order:vip.html.twig' %}
        {% endif %}
        {% if targetType == "classroom" %}
          {% include 'TopxiaWebBundle:Order:classroom.html.twig' %}
        {% endif %}
        {% if targetType == "groupSell" %}
          {% include 'GroupSellBundle:GroupSell:Order/group_sell.html.twig' %}
        {% endif %}
        </div>

        {% if targetType in ['course','vip','classroom'] %}
          <div class="order-detail-bg">

            {% if (is_plugin_installed("Coupon") and setting('coupon.enabled')) 
                or setting('invite.invite_code_setting')|default(false) 
            %}
              {{ render(controller('TopxiaWebBundle:Card:useableCoupons', {targetType: targetType, targetId: targetId, totalPrice: totalPrice,priceType:priceType|default('RMB') })) }}
            {% endif %}

            {% if setting('coin.coin_enabled') %}
            	{% include 'TopxiaWebBundle:Order:order-item-coin.html.twig' %}
            {% endif %}

          </div>
        {% endif %}

        <div class="form-group">
          <div class="total-price">
            {{'应付金额：'|trans}}
            {% if priceType|default('RMB') == "Coin" %}
              <span role="pay-coin">0</span> {{setting("coin.coin_name")}} ÷ {{'汇率'|trans}}({{cashRate|default(1)}}) = <span class="pay-rmb">￥</span> <span role="pay-rmb" class="pay-rmb"></span> {{'元'|trans}}
            {% else %}
              <span class="pay-rmb">￥</span><span role="pay-rmb" class="pay-rmb"></span>
            {% endif %}
          </div>
        </div>
        <div class="form-group text-right">
          <a
            {% if targetType == "course" and course|default(null) %}
              href="{{ path('course_show', {id:course.id}) }}"
            {% elseif targetType == "vip" %}
              href="{{ path('vip_renew') }}"
            {% elseif targetType == "classroom" %}
              href="{{ path('classroom_show', {id:classroom.id}) }}"
            {% endif %}
            class="btn btn-link" style="">{{'取消'|trans}}</a>
          {% if ((setting('cloud_sms.sms_enabled')|default('')) == '1') and ((setting('cloud_sms.sms_user_pay')|default('')) == 'on') %}
            <a class="btn btn-primary" id="js-order-create-sms-btn" data-toggle="modal" data-target="#modal" data-url="{{path('order_pay_sms_verification')}}" >{{'提交订单'|trans}}</a>
          {% else %}
            <button class="btn btn-primary" id="order-create-btn" type="submit">{{'提交订单'|trans}}</button>
          {% endif %}
        </div>
      </form>
    </div>
  </div>
</div>
{% endblock %}